from importlib import import_module
from app.modules.v1 import api_v1
from app.extensions import limiter
from app.extensions.exception import Success


def configure_blueprints(app):

    app.register_blueprint(api_v1)
    
    
    # 注册界面模块
    for module_name in ("web.authentication", "web.home"):
        module = import_module("app.modules.{}.routes".format(module_name))
        app.register_blueprint(module.blueprint)


    # 健康检查
    @app.route('/health')
    @limiter.exempt()
    def health():
        return Success()
